//
// Created by xili on 2024/9/18 11:14.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    int minMovesToSeat(vector<int> &seats, vector<int> &students) {
        ranges::sort(seats);
        ranges::sort(students);
        int n = seats.size();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            ans += abs(seats[i] - students[i]);
        }
        return ans;
    }
};